import {
  HTTP,
  showError
} from '../../utils/request.js'
const http = new HTTP()
import {
  formatDate
} from '../../utils/util.js'

const app = getApp()
Page({
  data: {
    imgUrl:[
      '../../images/swipper/1.jpg',
      '../../images/swipper/2.jpg',
      '../../images/swipper/3.jpg',
      '../../images/swipper/4.jpg'
    ],
    current:0,
    indicatorDots:true,
    autoplay:false,
    interval:5000,
    duration:1000,
    labels: [{
      id: 0,
      img: '/images/baike.png',
      title: '查疾病'
    },
    {
      id: 1,
      img: '/images/ask.png',
      title: '速提问'
    },
    ],
    news: [{
      id: 0,
      thumb: '/images/doctor.png',
      title: '秃顶为什么没有被自然淘汰？',
      content: '一个性状是否会被自然选择淘汰，不止是是是是是是是所所所所所所所所所所所所所所所所所所所所所所所所所所所所所所所'
    },
    {
      id: 1,
      thumb: '/images/doctor.png',
      title: '隐形正畸的危害？30岁再进行正畸还来得及吗？',
      content: '一个性状是否会被自然选择淘汰，不止是是是是是是是所所所所所所所所所所所所所所所所所所所所所所所所所所所所所所所所所所所所所所所所所所所所所所所所所'
    },
    {
      id: 2,
      thumb: '/images/doctor.png',
      title: '秃顶为什么没有被自然淘汰？',
      content: '一个性状是否会被自然选择淘汰，不止是是是是是是是所所所所所所所所所所所所所所所所所所所所所所所所所所所所所所所'
    },
    ]
  },

  onload() {
  },
  swiperChange:function(e){
    //console.log(this.data.current)
    this.setData({
    current:e.detail.current  
    })
  },
  swiperClick:function(e){
    //console.log(this.data.swiperCurrent)
    if (this.data.current==0)
    {
      wx.navigateTo({ url: '/pages/ask/ask' });  
    }else
    {
      wx.navigateTo({ url: '/pages/diseases/diseases' });
    }
    //console.log(this.data.current)
  },
  onLabel(e) {
    console.log(e)
    const id = e.currentTarget.dataset.id
    if (id === 1) {
      wx.navigateTo({ url: '/pages/ask/ask' });
    } else if (id === 0) {
      wx.navigateTo({ url: '/pages/diseases/diseases' });
    }
  },

  onBtn(e) {
    wx.navigateTo({ url: '/pages/question/question' });
  }
})